<!-- Main Sidebar Container -->
{% url 'cms:category_manage_view' as category_manage_view %}
{% url 'cms:category_publish_view' as category_publish_view %}
{% url 'cms:category_edit_view' as category_edit_view %}
{% url 'cms:post_manage_view' as post_manage_view %}
{% url 'cms:post_publish_view' as post_publish_view %}
{% url 'cms:post_manage_view' as post_manage_view %}
{% url 'cms:post_publish_view' as post_publish_view %}
{% url 'cms:post_edit_view' as post_edit_view %}
{% url 'cms:user_manage_view' as user_manage_view %}
{% url 'cms:user_publish_view' as user_publish_view %}
{% url 'cms:user_edit_view' as user_edit_view%}
<aside class="main-sidebar sidebar-dark-primary elevation-4">
  <a href="{% url 'cms:dashboard' %}" class="brand-link">
    <img
      src="{% static 'image/cms_logo.png' %}"
      class="brand-image img-circle elevation-3"
      style="opacity: .8"
    />
    <span class="brand-text font-weight-light">Peekpa 管理系统</span>
  </a>

  <div class="sidebar">
    <nav class="mt-2">
      <ul
        class="nav nav-pills nav-sidebar flex-column"
        data-widget="treeview"
        role="menu"
        data-accordion="false"
      >
      {% url 'cms:dashboard' as cms_home_page %}
        <li class="nav-item">
          <a
            href="{{ cms_home_page }}"
            class="nav-link {% if request.path == cms_home_page %}active{% endif %}"
          >
            <i class="nav-icon fas fa-tachometer-alt"></i>
            <p>控制台</p>
          </a>
        </li>
        
        <li
  class="nav-item has-treeview {% if request.path == category_manage_view or request.path == category_publish_view %}menu-open{% endif %}"
>
  <a
    href="#"
    class="nav-link {% if request.path == category_manage_view or request.path == category_publish_view %}active{% endif %}"
  >
    <i class="nav-icon far fa-bookmark"></i>
    <p>
      分类标签
      <i class="right fas fa-angle-left"></i>
    </p>
  </a>
  <ul class="nav nav-treeview">
    <li class="nav-item">
      <a
        href="{{ category_manage_view }}"
        class="nav-link {% if request.path == category_manage_view %}active{% endif %}"
      >
        <i class="far fa-circle nav-icon"></i>
        <p>标签列表</p>
      </a>
    </li>
    <li class="nav-item">
      <a
        href="{{ category_publish_view }}"
        class="nav-link {% if request.path == category_publish_view %}active{% endif %}"
      >
        <i class="far fa-circle nav-icon"></i>
        <p>标签发布</p>
      </a>
    </li>
  </ul>
</li>
<li
  class="nav-item has-treeview {% if request.path == post_manage_view or request.path == post_publish_view or request.path == post_edit_view %}menu-open{% endif %}"
>
  <a
    href="{{ post_manage_view }}"
    class="nav-link {% if request.path == post_manage_view or request.path == post_publish_view or request.path == post_edit_view %}active{% endif %}"
  >
    <i class="nav-icon far fa-copy"></i>
    <p>
      文章管理
      <i class="right fas fa-angle-left"></i>
    </p>
  </a>
  <ul class="nav nav-treeview">
    <li class="nav-item">
      <a
        href="{{ post_manage_view }}"
        class="nav-link {% if request.path == post_manage_view or request.path == post_edit_view %}active{% endif %}"
      >
        <i class="far fa-circle nav-icon"></i>
        <p>文章列表</p>
      </a>
    </li>
    <li class="nav-item">
      <a
        href="{{ post_publish_view }}"
        class="nav-link {% if request.path == post_publish_view %}active{% endif %}"
      >
        <i class="far fa-circle nav-icon"></i>
        <p>文章发布</p>
      </a>
    </li>
  </ul>
</li>
{% if request.user.is_superuser %}
<li
  class="nav-item has-treeview {% if request.path == user_manage_view or request.path == user_publish_view  or request.path == user_edit_view %}menu-open{% endif %}"
><!-- 新添加修改代码 -->
  <a
    href="#"
    class="nav-link {% if request.path == user_manage_view or request.path == user_publish_view or request.path == user_edit_view %}active{% endif %}"
    ><!-- 新添加修改代码 -->
    <i class="nav-icon fas fa-user"></i>
    <p>
      用户管理
      <i class="right fas fa-angle-left"></i>
    </p>
  </a>
  <ul class="nav nav-treeview">
    <li class="nav-item">
      <a
        href="{% url 'cms:user_manage_view' %}"
        class="nav-link {% if request.path == user_manage_view  or request.path == user_edit_view %}active{% endif %}"
        ><!-- 新添加修改代码 -->
        <i class="far fa-circle nav-icon"></i>
        <p>用户列表</p>
      </a>
    </li>
    <li class="nav-item">
      <a
        href="{% url 'cms:user_publish_view' %}"
        class="nav-link {% if request.path == user_publish_view%}active{% endif %}"
      >
        <i class="far fa-circle nav-icon"></i>
        <p>新建用户</p>
      </a>
    </li>
  </ul>
</li>
{% endif %}

      </ul>
    </nav>
  </div>
</aside>